﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.IO;
using System.Windows;
namespace Shakes_and_Fidget___Charplaner
{
    static class Program
    {
        /// <summary>
        /// Der Haupteinstiegspunkt für die Anwendung.
        /// </summary>
        public static StreamWriter log = new StreamWriter(Environment.CurrentDirectory + "\\log.txt",true);
        [STAThread]
        static void Main()
        {
			/*Classes.Player p = new Classes.Player(Classes.Unit.Class.WARRIOR, 128, 2574, 1000, 975, 1813, 1251, 6182, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", 0);
			Classes.Player e = new Classes.Player(Classes.Unit.Class.WARRIOR, 130, 2861, 563, 698, 1558, 1203, 7516, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", 0);
			Classes.Unit u = new Classes.Unit(Classes.Unit.Class.WARRIOR, 2861, 563, 698, 1558, 1203, 130, 7516, 0, 208, 300);
			Classes.Item i = new Classes.Item(null, null, null, Classes.Item.Slot.WEAPON, 0, 199, 305);
			Classes.Item ie = new Classes.Item(null, null, null, Classes.Item.Slot.WEAPON, 0, 208, 300);
			e.weapon = ie;
			p.weapon = i;
			p.SetWeaponDamage();
			e.SetWeaponDamage();
			double px = p.GetCrit();
			px = p.GetAttackPower()[0];
			px = p.GetAttackPower()[1];
			px = p.GetDamageReduction();
			px = p.GetDefence();
			px = p.GetDEX();
			px = p.GetDodge();
			px = p.GetINT();
			px = p.GetLife();
			px = p.GetLifeMult();
			px = p.GetLUCK();
			px = p.GetMainAttribute();
			px = p.GetResistance();
			px = p.GetSTAM();
			px = p.GetSTR();
			px = p.GetWeaponDamage()[0];
			px = p.GetWeaponDamage()[1];
			int mylife = (int)p.GetLife();
			int hislife = (int)e.GetLife();
			for (int x = 1; x <= 16; x++)
			{
				hislife -= (int)p.GetDamage(x, e.GetDefence(), e.GetDamageReduction());
				mylife -= (int)e.GetDamage(x, p.GetDefence(), p.GetDamageReduction());
			}
			px = u.GetAttackPower()[0];
			px = u.GetAttackPower()[1];
			px = u.GetCrit();
			px = u.GetDamageReduction();
			px = u.GetDefence();
			px = u.GetDEX();
			px = u.GetDodge();
			px = u.GetINT();
			px = u.GetLife();
			px = u.GetLifeMult();
			px = u.GetLUCK();
			px = u.GetMainAttribute();
			px = u.GetResistance();
			px = u.GetSTAM();
			px = u.GetSTR();
			px = u.GetWeaponDamage()[0];
			px = u.GetWeaponDamage()[1];
			px = i.GetArmor();
			px = i.GetBlockRate();
			px = i.GetWeaponDamage()[0];
			px = i.GetWeaponDamage()[1];
			string n = i.atr1.GetName();
			n = i.atr2.GetName();
			 */
			
            log.AutoFlush = true;
            if(!File.Exists(Environment.CurrentDirectory + "\\log.txt"))
                File.Create(Environment.CurrentDirectory + "\\log.txt");
			
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new sfc());
            }
            catch (Exception e)
            {
                LogWrite(e);
            }
            finally
            { log.Close(); }
        }
        public static void LogWrite(Exception e)
        {
            log.Write("[" + DateTime.Now + "]" + e.Message);
            log.Write("\r\n[Stack Trace]\r\n" + e.StackTrace + "\r\n [STACK TRACE END]\r\n");
            log.Write("[Source] " + e.Source + "[SOURCE END]\r\n");
            MessageBox.Show("Es ist ein Fehler in der Anwendung aufgetreten.\r\nBitte sende die Datei \r\n\n\"" + Environment.CurrentDirectory + "\\log.txt\"\r\n\nan einen Entwickler.\r\n" + e.Message, e.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
}
